home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 120
/
Vol 120.iso
/
games
/
anacroz.swf
/
scripts
/
DefineButton2_1806
/
BUTTONCONDACTION on(press).as
Wrap
Text File
|
2010-11-09
|
4KB
|
106 lines
on(press){
var limite = false;
switch(_root.rc_sel)
{
case 1:
if(_root.edCustoTotal + _root.sd_valores[GRR][VALOR] > _root.edFundos)
{
_root.showAlert("O valor de recrutamento desse soldado ultrapassa o limite de gastos!");
}
else if(_root.rc_total < _root.sd_num_max)
{
_root.rc_1.qtd = Number(_root.rc_1.qtd) + 1;
_root.rc_total = _root.rc_total + 1;
_root.edCustoTotal = Number(_root.edCustoTotal) + _root.sd_valores[GRR][VALOR];
}
else
{
limite = true;
}
break;
case 2:
if(_root.edCustoTotal + _root.sd_valores[ARQ][VALOR] > _root.edFundos)
{
_root.showAlert("O valor de recrutamento desse soldado ultrapassa o limite de gastos!");
}
else if(_root.rc_total < _root.sd_num_max)
{
_root.rc_2.qtd = Number(_root.rc_2.qtd) + 1;
_root.rc_total = _root.rc_total + 1;
_root.edCustoTotal = Number(_root.edCustoTotal) + _root.sd_valores[ARQ][VALOR];
}
else
{
limite = true;
}
break;
case 3:
if(_root.edCustoTotal + _root.sd_valores[CAV][VALOR] > _root.edFundos)
{
_root.showAlert("O valor de recrutamento desse soldado ultrapassa o limite de gastos!");
}
else if(_root.rc_total < _root.sd_num_max)
{
_root.rc_3.qtd = Number(_root.rc_3.qtd) + 1;
_root.rc_total = _root.rc_total + 1;
_root.edCustoTotal = Number(_root.edCustoTotal) + _root.sd_valores[CAV][VALOR];
}
else
{
limite = true;
}
break;
case 4:
if(_root.edCustoTotal + _root.sd_valores[MAG][VALOR] > _root.edFundos)
{
_root.showAlert("O valor de recrutamento desse soldado ultrapassa o limite de gastos!");
}
else if(_root.rc_total < _root.sd_num_max)
{
_root.rc_4.qtd = Number(_root.rc_4.qtd) + 1;
_root.rc_total = _root.rc_total + 1;
_root.edCustoTotal = Number(_root.edCustoTotal) + _root.sd_valores[MAG][VALOR];
}
else
{
limite = true;
}
break;
case 5:
if(_root.edCustoTotal + _root.sd_valores[CLR][VALOR] > _root.edFundos)
{
_root.showAlert("O valor de recrutamento desse soldado ultrapassa o limite de gastos!");
}
else if(_root.rc_total < _root.sd_num_max)
{
_root.rc_5.qtd = Number(_root.rc_5.qtd) + 1;
_root.rc_total = _root.rc_total + 1;
_root.edCustoTotal = Number(_root.edCustoTotal) + _root.sd_valores[CLR][VALOR];
}
else
{
limite = true;
}
break;
case 6:
if(_root.edCustoTotal + _root.sd_valores[CAT][VALOR] > _root.edFundos)
{
_root.showAlert("O valor de recrutamento desse soldado ultrapassa o limite de gastos!");
}
else if(_root.rc_total < _root.sd_num_max)
{
_root.rc_6.qtd = Number(_root.rc_6.qtd) + 1;
_root.rc_total = _root.rc_total + 1;
_root.edCustoTotal = Number(_root.edCustoTotal) + _root.sd_valores[CAT][VALOR];
}
else
{
limite = true;
}
}
if(limite)
{
_root.showAlert("Máximo de 15 soldados atingido!");
}
}